﻿@model FairyWorld.Models.User

@{
    ViewBag.Title = "Info";
    Layout = "~/Views/Shared/BlankLayout.cshtml";
}

<div class="span7">
    <img class="img-rounded" src="@ViewBag.User.iconUrl" style="width:200px">
</div>
<div class="span7">
    <fieldset>
        <legend>个人信息</legend>
        <div style="font-size:15px">
            <div class="display-field">
                用户名 : @Html.DisplayFor(model => model.username)
            </div>
            <div class="display-field">
               电话 :  @Html.DisplayFor(model => model.phone)
            </div>
            <div class="display-field">
                邮箱 :  @Html.DisplayFor(model => model.email)
            </div>
            <div class="display-field">
                已用空间 : 
                @{
                var fsize = 0.0;
                if (ViewBag.Size < (1 << 10))
                {
                    fsize = ViewBag.Size;
                    fsize = Math.Round(fsize, 2);
                    @(fsize.ToString()+"B")
                }
                else if(ViewBag.Size < (1 << 20))
                {
                    fsize = (ViewBag.Size / (double)(1<<10));
                    fsize = Math.Round(fsize, 2);
                    @(fsize.ToString()+"KB")
                }
                else
                {
                    fsize = (ViewBag.Size / (double)(1<<20));
                    fsize = Math.Round(fsize, 2);
                    @(fsize.ToString()+"MB")
                }
                    
                }
            </div>
            <div class="display-field">
                可用空间 :
                @{
                var fspace = 0.0;  
                if (ViewBag.Space < (1 << 10))
                {
                    fspace = ViewBag.Space;
                    fspace = Math.Round(fspace, 2);
                    @(fspace.ToString()+"B")
                }
                else if (ViewBag.Space < (1 << 20))
                {
                    fspace = (ViewBag.Space / (double)(1<<10));
                    fspace = Math.Round(fspace, 2);
                    @(fspace.ToString()+"KB")
                }
                else
                {
                    fspace = (ViewBag.Space / (double)(1<<20));
                    fspace = Math.Round(fspace, 2);
                    @(fspace.ToString()+"MB")
                }
                }
            </div>

            <p>
                @Html.ActionLink("编辑", "Edit", new { id=Model.UserId })
            </p>
        </div>
    </fieldset>
</div>



